package com.shadow.study.test.线程1;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FullBackController {

    @PostMapping("ttt")
    public void notifyShen(@RequestBody JSONObject notifyData) {
        JSONObject data = notifyData.getJSONObject("data");
        String requestId = data.getString("requestId");
        ReceiveNotifyHandlerManage.getOrDestroyHandler(requestId,null,false,true);
        ReceiveNotifyHandler handler = ReceiveNotifyHandlerManage.getOrDestroyHandler(requestId, notifyData, false, false);
        if(handler != null) {
            handler.receiveNotify();
            ReceiveNotifyHandlerManage.getOrDestroyHandler(requestId,null,false,true);
            handler = null;
        } else {
            System.out.println("===== 其他线程已处理 终止回调");
        }
    }
}
